The invention is related to the field of data communications, and in particular, to a system for transferring data over a serial data link between data communication devices.
The use of data communications systems has become a critical factor in technological development and economic growth. Data communications devices, such as computers, microprocessors, and disk drives, communicate using a variety of data communications protocols. A well-known data communications protocol is Binary Synchronous Communications (BSC) that was developed by IBM in the mid-1960s.
BSC is based on the transmission of a single stream of binary bits. The bit stream includes binary-encoded user data and control codes. The data communications system uses the control codes to set-up and release the data link, to de-limit the user data, and to perform error checks. BSC is described in the various IBM publications. The IBM publication entitled xe2x80x9cGeneral Informationxe2x80x94Binary Synchronous Communicationsxe2x80x9d with File Number TP-09 and Order Number GA27-3004-2 is hereby incorporated by reference into this application.
Unfortunately, BSC has features that restrict its utility in some current data communications systems. BSC is synchronous and is not suitable for devices that transmit data asynchronously. BSC does not restrict the size of a data block and can overflow the receive buffer unless the buffer is very large. Large buffers add cost to the system. BSC uses polling and selection to establish data links between devices. Polling and selection can lead to contention if two devices simultaneously request control of the data link. Contention only hinders performance in systems where a master device should control the communications.
BSC has an element of complexity that is problematic for some systems. The complexity may require too much skill from the system designer or may simply be unnecessary. BSC has techniques for polling, flow control, and termination that could be simplified or eliminated. For example, BSC has its own set of flow control codes and does not accommodate the standard XOFF-XON flow control codes that are commonly used in asynchronous communications. A system designer must understand and use the flow control in BSC instead of using the standard XOFF and XON codes.
BSC acknowledges transmissions by sequencing acknowledgment codes so an acknowledgment is not attributed to the wrong transmission. The BSC also uses the acknowledgment code to respond to an initialization request. The response to initialization can be confused with an actual acknowledgment and place the system out-of-sequence.
A similar sequencing problem arises with the use of the enquiry code and the end-of-transmission code. BSC places line-bids with an enquiry code. BSC also uses the enquiry code to request the re-transmission of the last acknowledgment. BSC uses an end-of-transmission code to terminate a data transaction. An enquiry code requesting the last acknowledgment can be confused with an enquiry code for a line bid if the end-of-transmission code is lost.
At present there is a need for an asynchronous data communications system that avoids the unneeded complexity of BSC. Such a system should remove contention from link control and avoid buffer overflow. The system should also avoid the flow control and sequencing problems inherent with the BSC control codes.
The invention overcomes the above problems by providing an asynchronous data communications system that avoids the unneeded complexity of BSC. The data communications system uses a master-slave hierarchy to remove contention from link control. The data communications system separates the user data block into frames to prevent buffer overflow in small buffers. The data communications system adds new control codes and encoding to avoid the flow control and sequencing problems inherent with the BSC control codes. The data communications system also adds a byte count for error checking to increase system reliability. As a result, the invention is easier to use when designing a data communications system.
The invention includes a method for transferring user data between a first data communications device and a second data communications device. The first data communications device transmits a first control code to the second data communications device. The first control code is a DLE-BEL that requests initialization of the second data communications device to receive the user data. The second data communications device transmits a second control code to the first data communications device in response to the first control code. The second control code is a DLE-SI that indicates that the second data communications device is initialized to receive the user data.
The first data communications device transmits a third control code to the second data communications device in response to the second control code. The third control code is a DLE-STX that identifies the start of a frame of user data. After the third control code, the first communications device transmits a count of bytes of user data in the frame. The first data communications device transmits user data to the second data communications device after transmitting the count. The first data communications device transmits a fourth control code to the second data communications device after transmitting the user data. The fourth control code is either a DLE-ETB, DLE-ETX, or DLE-ESC that identifies the end of the frame of user data. The first data communications device transmits a check value to the second data communications device after transmitting the fourth control code.
The second data communications device transmits a fifth control code to the first data communications device in response to processing the count and the check value. The fifth control code is either DLE-p or a DLE-a to acknowledge that the frame of user data is complete and error-free. The use of DLE-p and DLE-a alternates for consecutive frames. It is important to note that the fifth control code DLE-p or DLE-a is different from the second control code DLE-SI. BSC uses the same control code to serve of the functions of both the DLE-SI and the DLE-p or DLE-a. The invention uses a DLE-SI for initialization to avoid any confusion with a subsequent DLE-p or DLE-a that might put the system out-of-sequence.
In some embodiments, the fourth control code is a DLE-ETX that indicates the end of the user data block without any line-turn. The invention does not require a special control code that ends a data transfer session. In contrast, BSC must transmit an End-Of-Transmission (EOT) code to end the data transfer session. The EOT is required because BSC uses the ENQ code for initialization and to query for a lost acknowledgment. If the EOT is not received to end a transaction, then the receiving device treats the next ENQ as a query and not as an initialization. The system is placed out-of-sequence if the block counter is odd. The invention avoids this confusion by using the DLE-BEL for initialization and by using a DLE-ESC to turn the line around. The EOT is eliminated.
In some embodiments, the fourth control code is an ESC that indicates a line-turn. The second data communications device transmits a second frame of the user data to the first data communications device in response to the fourth control codes and after sending the fifth control code. The line-turn is important because it is implemented by the master device, and is the only way the slave can transfer user data. Control by the master avoids any contention problems present in the polling and selection technique used in BSC.
In some embodiments, the first data communications device transmits a seventh control code to the second data communications device if it does not receive an acknowledgment after transmitting the frame of the user data. The seventh control code is a DLE-ENQ. BSC uses the ENQ for both initialization and query upon lost acknowledgment. The invention uses a DLE-ENQ to query for an acknowledgment and uses a DLE-BEL for initialization to avoid any confusion that might put the system out-of-sequence.
The invention allows the use of the standard XON or XOFF flow control codes that are encoded as DC1 and DC3 respectively. If the user data or the check value happens to include a bit string matching DC1 or DC3, then the bit string is encoded with DLE-DC2 and DLE-DC4 respectively and the matching bit strings are replaced by the receiver. BSC does not allow the use of the standard XON and XOFF codes. A BSC user must learn to use the Wait-Before-Transmit Positive Acknowledgment (WACK) and Temporary Text Delay (TTD) codes for flow control.